/**
 * The main application class. An instance of this class is created by app.js when it calls
 * Ext.application(). This is the ideal place to handle application launch and initialization
 * details.
 */
Ext.define('Mayfle.Application', {
	extend: 'Ext.ux.desktop.App',

	name: 'Mayfle',

	init: function() {
		this.callParent();
	},

	requires: [
		'Ext.ux.desktop.ShortcutModel',
		'Mayfle.view.mywork.View'
	],

	stores: [
		// TODO: add global / shared stores here
	],

	launch: function() {
		// TODO - Launch the application
	},

	getModules: function() {
		return [
			new Mayfle.view.mywork.View()
		];
	},

	getDesktopConfig: function() {

		var me = this,
			ret = me.callParent();

		return Ext.apply(ret, {
			contextMenuItems: [{
				text: '个性化',
				scope: me
			}],
			shortcuts: Ext.create('Ext.data.Store', {
				model: 'Ext.ux.desktop.ShortcutModel',
				data: [{
					name: '我的工作',
					iconCls: 'grid-shortcut',
					module: 'myWork'
				}]
			}),
			wallpaper: 'resources/images/wallpapers/Blue-Sencha.jpg',
			wallpaperStretch: false
		});

	},

	getStartConfig: function() {
		var me = this,
			ret = me.callParent();

		return Ext.apply(ret, {
			title: 'Rocky',
			iconCls: 'user',
			height: 300,
			toolConfig: {
				width: 100,
				items: [{
						text: '个性化',
						iconCls: 'settings',
						handler: me.onSettings,
						scope: me
					},
					'-', {
						text: '注销',
						iconCls: 'logout',
						handler: me.onLogout,
						scope: me
					}
				]
			},
			fbar: [{
				type: 'button',
				text: '点我',
				handler: me.clickMe
			}],
			html: 'ddd'
		});
	},

	getTaskbarConfig: function () {
        var ret = this.callParent();

        return Ext.apply(ret, {
			startBtnText:"美疯啦",
            quickStart: [
                { name: '我的工作', iconCls: 'grid-shortcut', module: 'myWork' },
                { name: '我的工作', iconCls: 'notepad', module: 'myWork' }
            ],
            trayItems: [
                { xtype: 'trayclock', flex: 1 }
            ]
        });
    },

	onLogout: function() {
		Ext.MessageBox.confirm("提示", "你要退出系统吗?");
	},

	clickMe: function() {
		Ext.MessageBox.alert("我去", "我去，你还真点了");
	}
});
